package com.sh.group;



import com.sh.Utils.EuclideanDistanceCalculator_My;
import com.sh.bean.BankMarketing_my;
import com.sh.bean.Distance_My;
import com.sh.bean.MySample;

import java.util.List;

public class GroupDistanceTask_My implements Runnable {
    private Distance_My[] distanceMies;
    private int startIndex;
    private int endIndex;
    private List<BankMarketing_my> train;
    private MySample example;
    private EuclideanDistanceCalculator_My edc = new EuclideanDistanceCalculator_My();

    public GroupDistanceTask_My(Distance_My[] distanceMies, int startIndex, int endIndex, List<BankMarketing_my> train, MySample example) {
        this.distanceMies = distanceMies;
        this.startIndex = startIndex;
        this.endIndex = endIndex;
        this.train = train;
        this.example = example;
    }

    @Override
    public void run() {
        for (int index = startIndex; index < endIndex; index++) {
            MySample sample = train.get(index);
            double distance = edc.calculate_My(example, sample);
            Distance_My distanceMy = new Distance_My(index, distance);
            distanceMies[index] = distanceMy;
        }


    }
}
